import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '代码类别',
    dataIndex: 'codeType',
    width: 300,
    slots: { customRender: 'codeType' },
  },
  {
    title: '代码名称',
    dataIndex: 'codeName',
    width: 280,
  },
  {
    title: '固定配置项',
    dataIndex: 'fixed',
    width: 180,
    slots: { customRender: 'fixed' },
  },
  {
    title: '备注',
    dataIndex: 'memo',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'codeType',
    label: '代码类别',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'codeName',
    label: '代码名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'codeType',
    label: '代码类别',
    component: 'Input',
    required: true,
  },
  {
    field: 'codeName',
    label: '代码名称',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'memo',
    component: 'InputTextArea',
  },
];

export const itemColumns: BasicColumn[] = [
  {
    title: '代码值',
    dataIndex: 'codeValue',
    width: 300,
  },
  {
    title: '代码名称',
    dataIndex: 'codeName',
    width: 280,
  },
  {
    title: '代码类别',
    dataIndex: 'codeType',
    width: 280,
  },
  {
    title: '固定配置项',
    dataIndex: 'fixed',
    width: 180,
    slots: { customRender: 'codeType' },
  },
  {
    title: '备注',
    dataIndex: 'memo',
  },
];

export const itemFormSchema: FormSchema[] = [
  {
    field: 'codeType',
    label: '代码类别',
    component: 'Input',
    required: true,
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'codeValue',
    label: '代码值',
    required: true,
    component: 'Input',
  },
  {
    field: 'codeName',
    label: '代码名称',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'memo',
    component: 'InputTextArea',
  },
];
